import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'

Vue.config.productionTip = false

import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
Vue.use(ElementUI)

// 引入wujie
import WujieVue from "wujie-vue2";
Vue.use(WujieVue)

const {bus} = WujieVue

// 在子应用模块路由激活时将路由同步给主应用，主应用跳转对应路由高亮菜单栏
bus.$on("sub-route-change", (name, path) => {
  // const mainName = `${name}`;
  const mainPath = `/${name}${path}`;
  // const currentName = router.currentRoute.name;
  const currentPath = router.currentRoute.path;
  if (/*mainName === currentName && */mainPath !== currentPath) {
    router.push({path: mainPath});
  }
});

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
